<template>
	<view>
		<view class="notice-item" v-for="(item, index) in ntcList" :key="item.id">
			<text class="time">{{renderTimeYMDHMS(item.ntcTime)}}</text>
			<view class="content">
				<view class="title">{{item.ntcTitle}}</view>
				<view class="introduce">{{item.ntcCont}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad: function(option) {
			var naviData = JSON.parse(option.naviData);
			this.getActivityNtc(naviData.actId);
		},
		data() {
			return {
				ntcList: [],
			}
		},
		methods: {
			//修改时间格式：年月日时分秒
			renderTimeYMDHMS(date) {
			  var dateee = new Date(date).toJSON();
			  return new Date(+new Date(dateee) + 8 * 3600 * 1000)
						.toISOString()
						.replace(/T/g, ' ')
						.replace(/\.[\d]{3}Z/, '') 
			},
			//获取活动通知信息
			getActivityNtc(actId) {
				uni.request({
				    url: 'http://ronin.fun:8888/act/ntc',
					data: {
						actId: actId,
					},
				    success: (res) => {
						this.ntcList = res.data.data;
						console.log(res.data);
				    }
				});
			}
		}
	}
</script>

<style lang='scss'>
	page {
		background-color: #f7f7f7;
		padding-bottom: 30upx;
	}

	.notice-item {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.time {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 80upx;
		padding-top: 10upx;
		font-size: 26upx;
		color: #7d7d7d;
	}

	.content {
		width: 710upx;
		padding: 0 24upx;
		background-color: #fff;
		border-radius: 4upx;
	}

	.title {
		display: flex;
		align-items: center;
		height: 90upx;
		font-size: 32upx;
		color: #303133;
		border-bottom: 1upx solid #f2f2f2;
		
	}

	.introduce {
		display: inline-block;
		padding: 16upx 0;
		font-size: 28upx;
		color: #606266;
		line-height: 38upx;
	}
</style>
